package com.xhwl.logistics.enums;

import lombok.Getter;

import java.util.HashMap;
import java.util.Map;
import java.util.Optional;

@Deprecated   //2022年01月需求，进出场方式重新定义，以VehiclePassTypeEnum枚举为准
@Getter
public enum VehicleExitTypeEnum {

    AUTO(1, "自动开闸"),
    MANUAL(2, "手动开闸"),
    EXIT_TYPE_NOTHING(99, "Nothing_Exit_Type");

    private static final Map<Integer, VehicleExitTypeEnum> map;
    static {
        map = new HashMap<>();
        for (VehicleExitTypeEnum vehicleExitTypeEnum : VehicleExitTypeEnum.values()) {
            map.put(vehicleExitTypeEnum.getId(), vehicleExitTypeEnum);
        }
    }

    VehicleExitTypeEnum(Integer id, String description) {
        this.id = id;
        this.description = description;
    }

    private final Integer id;

    private final String description;

    public static VehicleExitTypeEnum toVehicleExitTypeEnum(Integer id) {
        return Optional.ofNullable(map.get(id)).orElse(EXIT_TYPE_NOTHING);
    }

}
